﻿<div>
            <div class="pagination" style="margin-left:350px;">
            @if (ViewBag.itemOnPage == 10)
            {
                @Ajax.ActionLink("25 item on page", "OrderDetailsTable", new { itemOnPage = 25, page = ViewBag.currentPage, orderId = ViewBag.orderId }, new AjaxOptions { UpdateTargetId = "table", LoadingElementId = "loading", LoadingElementDuration = 1000 })
            }
            else
            {
                @Ajax.ActionLink("10 item on page", "OrderDetailsTable", new { itemOnPage = 10, page = ViewBag.currentPage, orderId = ViewBag.orderId }, new AjaxOptions { UpdateTargetId = "table", LoadingElementId = "loading", LoadingElementDuration = 1000 })
    
            }
        </div>
    <table class="rounded-corner">
        <thead>
            <tr>
                <th class="rounded-company">@Html.ActionLink("Id", "Index")</th>
                <th>@Html.ActionLink("Item Name", "Index")</th>
                <th>@Html.ActionLink("Item Description", "Index")</th>
                <th>@Html.ActionLink("Dimension", "Index")</th>
                <th>@Html.ActionLink("Price", "Index")</th>
                <th>@Html.ActionLink("Quantity", "Index")</th>
                <th>@Html.ActionLink("Total", "Index")</th>
                <th></th>
                <th class="rounded-q4"></th>
            </tr>
        </thead>
        @foreach (var c in ViewBag.OrdersDetails)
        {
            <tr>
                <td>@c.ItemDimension.Item.ItemId</td>
                <td>@c.ItemDimension.Item.Name</td>
                <td>@c.ItemDimension.Item.Name</td>
                <td>item</td>
                <td>@c.Price</td>
                <td>@c.Count</td>
                <td>@( c.Count * (float)c.Price)</td>
                <td>@Html.ActionLink("Edit", "Index")</td>
                <td>@Html.ActionLink("Delete", "Index")</td>
            </tr>

        }
        @if (ViewBag.OrdersDetails.Count != ViewBag.itemOnPage)
        {
            for (int i = 0; i < ViewBag.itemOnPage - ViewBag.OrdersDetails.Count; i++)
            {
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>

                <td></td>
                <td></td>
                <td></td>
            </tr>
            }
        }
    </table>

</div>

<div class="pagination">

    @if (ViewBag.currentPage == 1)
    {
        <span class="disabled">first</span>
        <span class="disabled">< prev</span>
    }
    else
    {
        <span>

            @Ajax.ActionLink("first", "OrderDetailsTable", new
       {

           itemOnPage = ViewBag.itemOnPage,
           page = 1,
           orderId = ViewBag.orderId

       }, new AjaxOptions
       {
           UpdateTargetId = "table",
           LoadingElementId = "loading",
           LoadingElementDuration = 1000
       })

        </span>
             
        <span>
            @Ajax.ActionLink("< prev", "OrderDetailsTable", new
       {
           itemOnPage = ViewBag.itemOnPage,
           page = ViewBag.currentPage - 1,
           orderId = ViewBag.orderId

       }, new AjaxOptions
       {
           UpdateTargetId = "table",
           LoadingElementId = "loading",
           LoadingElementDuration = 1000
       })

        </span>
             
             
    }
    @if (ViewBag.OrdersDetailsCount <= ViewBag.currentPage * ViewBag.itemOnPage)
    {
        <span class="disabled">next ></span>
        <span class="disabled">last</span>
    }
    else
    {
        <span>

            @Ajax.ActionLink("next >", "OrderDetailsTable", new
       {
           itemOnPage = ViewBag.itemOnPage,
           page = ViewBag.currentPage + 1,
           orderId = ViewBag.orderId

       }, new AjaxOptions
       {
           UpdateTargetId = "table",
           LoadingElementId = "loading",
           LoadingElementDuration = 1000
       })

        </span>
        <span>
            @Ajax.ActionLink("last", "OrderDetailsTable", new
       {
           itemOnPage = ViewBag.itemOnPage,
           page = ViewBag.lastPage,
           orderId = ViewBag.orderId

       }, new AjaxOptions
       {
           UpdateTargetId = "table",
           LoadingElementId = "loading",
           LoadingElementDuration = 1000
       })

        </span>
    }
</div>
